﻿Public Class frm_ReportsFromTo
#Region "Khai báo biến"
    Public gvStr_ReportType As String
#End Region
#Region "Hàm khởi tạo"
    Private Sub SubM_InitializeForm()
        Me.DateEdit1.DateTime = Today
        Me.DateEdit2.DateTime = Today
        If gvByte_Language = 1 Then
            Me.gpcArea.Text = "Vui lòng chọn ngày cần báo cáo!"
        Else
            Me.gpcArea.Text = "Please select date to view reports!"
        End If
    End Sub
#End Region
#Region "Form events"
    Private Sub frm_DiscountServiceVat_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SubM_InitializeForm()
    End Sub
#End Region
#Region "Hàm tạo gọi form để xem report"
    Private Sub SubM_CreateReportForm(ByVal iRpt_Obj As Object)
        Try
            iRpt_Obj.SetParameterValue("TuNgay", Me.DateEdit1.DateTime.Date)
            iRpt_Obj.SetParameterValue("DenNgay", Me.DateEdit2.DateTime.Date)
            Dim mvFrm_LoadReport As New frm_LoadReport(iRpt_Obj)
            Me.Close()
            mvFrm_LoadReport.ShowDialog()
        Catch ex As Exception

        End Try
    End Sub
#End Region
#Region "Nút Confirm"
    Private Sub cmdConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConfirm.Click
        Try
            If Me.gvStr_ReportType = "TaiChinh" Then
                Dim mvRpt_Report As New rpt_ReportFinance
                'Thêm tham số nếu cần thiết
                SubM_CreateReportForm(mvRpt_Report)
            ElseIf Me.gvStr_ReportType = "CTHoaDon" Then
                Dim mvRpt_Report As New rpt_ReportBillDetail
                SubM_CreateReportForm(mvRpt_Report)
            ElseIf Me.gvStr_ReportType = "HoaDon" Then
                Dim mvRpt_Report As New rpt_ReportBills
                SubM_CreateReportForm(mvRpt_Report)
            ElseIf Me.gvStr_ReportType = "ThuChi" Then
                Dim mvRpt_Report As New rpt_ReportReceiptPayment
                SubM_CreateReportForm(mvRpt_Report)
            ElseIf Me.gvStr_ReportType = "TraHang" Then
                Dim mvRpt_Report As New rpt_ReportReturn
                SubM_CreateReportForm(mvRpt_Report)
            ElseIf Me.gvStr_ReportType = "CongNo" Then
                Dim mvRpt_Report As New rpt_ReportDepts
                SubM_CreateReportForm(mvRpt_Report)
            End If
        Catch ex As Exception

        End Try
    End Sub
#End Region
#Region "Nút exit"
    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        Me.Close()
    End Sub
#End Region
End Class